package rad.framework.embedded;

import junit.extensions.TestSetup;
import junit.framework.Test;
import rad.framework.jboss.JBossBoostrap;
import rad.framework.jboss.seam.SeamBootstrap;

/**
 * This class simply wraps the real bootstraps to facilitate switching
 * implementations.
 * 
 * @author boudyacho
 */
public class Bootstrap extends TestSetup {

	public Bootstrap(Test test) {
		super(test);
	}

	protected void setUp() throws Exception {
		super.setUp();
		bootstrap();
	}

	protected void tearDown() throws Exception {
		shutdown();
		super.tearDown();
	}

	// ---------------------------------------------------------------
	// usable outside if testing
	// ---------------------------------------------------------------

	public static boolean isStarted() {
		return JBossBoostrap.isStarted() && SeamBootstrap.isStarted();
	}

	public static void bootstrap() {
		JBossBoostrap.bootstrap();
		SeamBootstrap.bootstrap();
	}

	public static void shutdown() {
		SeamBootstrap.shutdown();
		JBossBoostrap.shutdown();
	}
}
